package com.dingwen.treasure.model.entity.mybatisplus;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dingwen.treasure.model.entity.BaseTree;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 系统部门表
 *
 * @author dingwen
 * @TableName sys_department
 * @date 2022/06/22
 */
@ApiModel(value = "sysDepartment", description = "系统部门表")
@TableName(value = "sys_department")
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
public class SysDepartment extends BaseEntity implements Serializable, BaseTree {

    @TableField(exist = false)
    private static final long serialVersionUID = 1846387369003884677L;

    /**
     * 当前元素ID
     */
    @ApiModelProperty(value = "当前元素ID")
    @TableId(value = "id", type = IdType.AUTO)
    public Long id;

    /**
     * 父节点ID
     */
    @ApiModelProperty(value = " 父节点ID")
    @TableField(value = "parent_id")
    public Long parenId;


    /**
     * 祖级列表
     */
    @ApiModelProperty(value = "祖级列表")
    @TableField(value = "ancestors")
    private String ancestors;

    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称")
    @TableField(value = "name")
    private String name;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    @TableField(value = "order_number")
    private Integer orderNumber;

    /**
     * 负责人
     */
    @ApiModelProperty(value = "负责人")
    @TableField(value = "leader")
    private String leader;

    /**
     * 电话
     */
    @ApiModelProperty(value = "电话")
    @TableField(value = "phone")
    private String phone;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱")
    @TableField(value = "email")
    private String email;


    /**
     * 属性节点中转集合
     */
    @ApiModelProperty(value = "属性节点中转集合")
    @TableField(exist = false)
    private List children;


    @Builder(toBuilder = true)
    public SysDepartment(LocalDateTime createTime, LocalDateTime updateTime, Integer deleted, Integer version, String createBy, String updateBy, String remark, Long id, Long parenId, String ancestors, String name, Integer orderNumber, String leader, String phone, String email) {
        super(createTime, updateTime, deleted, version, createBy, updateBy, remark);
        this.id = id;
        this.parenId = parenId;
        this.ancestors = ancestors;
        this.name = name;
        this.orderNumber = orderNumber;
        this.leader = leader;
        this.phone = phone;
        this.email = email;
    }

    /**
     * 设置子项(数据中转)
     *
     * @param children 儿童
     */
    @Override
    public void setChildren(List children) {
        this.children = children;
    }

    /**
     * 获取子项(数据中转)
     *
     * @return {@link List}
     */
    @Override
    public List getChildren() {
        return children;
    }

    /**
     * 获取当前元素ID
     *
     * @return {@link Long}
     */
    @Override
    public Long getId() {
        return id;
    }

    /**
     * 获取树参数id
     *
     * @return {@link Long}
     */
    @Override
    public Long getParenId() {
        return parenId;
    }
}




